package com.rgs.se.singleton;

import java.util.Objects;

/**
 * @author Ren Gaoshuai
 * @ClassName TestSingleton4
 * @Description 单例模式 懒汉式 同步方法(线程安全)
 * @date 2021-09-02 10:01
 **/
public class TestSingleton4 {
    private static TestSingleton4 instance;

    public static synchronized TestSingleton4 getInstance(){
        if (Objects.isNull(instance)){
            instance = new TestSingleton4();
        }
        return instance;
    }
}
